package org.demo;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;

public class ShardRedisDemo {

	public static void main(String[] args) throws InterruptedException {
		{
			 Jedis redis= RedisUtil.getJedis();
				int count = 10000;
				Pipeline pipeline = redis.pipelined();
				// ShardedJedisPipeline p = sj.pipelined();
				long begin = System.currentTimeMillis();
				for (int i = 0; i < count; i++) {
					pipeline.set("ap" + i, "vp" + i);
				}
				pipeline.sync();
				redis.close();
				System.out.println(System.currentTimeMillis() - begin);
		}
		 {
			 Jedis redis= RedisUtil.getJedis();
				int count = 10000;
				long begin = System.currentTimeMillis();
				for (int i = 0; i < count; i++) {
					redis.set("a" + i, "v" + i);
				}
				redis.close();
				System.out.println(System.currentTimeMillis() - begin);
		}
	}
}